package com.ruoyi.web.controller.wnjk.app.hospital;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.wnjk.domain.po.WnjkHospital;
import com.ruoyi.system.wnjk.domain.po.WnjkPatient;
import com.ruoyi.system.wnjk.service.IWnjkHospitalService;
import com.ruoyi.system.wnjk.service.IWnjkPatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 医院信息Controller
 *
 * @author ruoyi
 * @date 2025-03-06
 */
@RestController
@RequestMapping("/app/hospital")
public class AppHospitalController extends BaseController
{
    @Autowired
    private IWnjkHospitalService wnjkHospitalService;

    @Autowired
    private IWnjkPatientService wnjkPatientService;

    /**
     * 查询医院信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(WnjkHospital wnjkHospital)
    {
        List<WnjkHospital> list = wnjkHospitalService.selectWnjkHospitalList(wnjkHospital);
        return getDataTable(list);
    }

    /**
     * 获取医院信息详细信息
     */
    // @PreAuthorize("@ss.hasPermi('hospital:hospital:query')")
    @GetMapping("/detail/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(wnjkHospitalService.selectWnjkHospitalById(id));
    }

    @GetMapping("/patient/list")
    public TableDataInfo list(WnjkPatient wnjkPatient)
    {
        List<WnjkPatient> list = wnjkPatientService.selectWnjkPatientList(wnjkPatient);
        return getDataTable(list);
    }
}
